<#assign menu="picture">
<#assign submenu="update_picture">
<#include "/system/head.ftl">
<style type="text/css">

</style>
<!--main content start-->
	<section id="main-content">
		<section class="wrapper">
		<!-- page start-->
			<div class="row">
			<div class="col-lg-12">
			<section class="panel">
				<header class="panel-heading">
 					修改图文
				</header>
				<div class="panel-body">
					<form id="update_picture_form" method="post" class="form-horizontal" autocomplete="off" action="${basePath}/admin/picture/update.json">
					<fieldset>
					<input type="hidden" name="pictureEntity.id" id="id" value="${pictureEntity.id?c}"/>
					<div class="form-group">
	                      <label class="col-sm-2 col-sm-2 control-label">图文地址</label>
	                      <div class="col-sm-6">
	                          <input type="text" readOnly="false" class="form-control" name="pictureEntity.picUrl"
	                          	placeholder="图文地址" id="picUrl" value="<#if pictureEntity.picUrl??>${pictureEntity.picUrl}</#if>">
	                          	<label class="col-lg-offset-10 ">
	                              	<button id="file_upload"  class="btn btn-shadow btn-info" type="button"><i class="icon-cloud-upload"></i> 上传图片</button>
	                         	</label>
	                      </div>
	                  </div>     
	                  <div class="form-group">
	                      <label class="col-sm-2 col-sm-2 control-label">图片名称</label>
	                      <div class="col-sm-10">
	                          <input type="text" class="form-control" name="pictureEntity.name"
	                          	placeholder="图片名称" id="name" value="<#if pictureEntity.name??>${pictureEntity.name}</#if>">
	                      </div>
	                  </div>
	                  <div class="form-group">
	                      <label class="col-sm-2 col-sm-2 control-label">所属栏目</label>
	                      <div class="col-sm-10">
	                          <select class="form-control" id="classId" name="pictureEntity.classId" style="font-size:15px;width: 300px;">
			                   		<#list classesList as classes>
			                   			<option style="background-color:#DFF0D8;font-weight:bold;" value="${classes.id}" <#if (pictureEntity.classId==classes.id)>selected</#if>>${classes.name}</option>
			                   		</#list>						
	                            </select>			
	                      </div>
	                    </div>  
	                   <div class="form-group">
	                      <label class="col-sm-2 col-sm-2 control-label">摘要</label>
	                      <div class="col-sm-10">
	                          <input type="text" style="font-size:15px;" class="form-control" id="description" name="pictureEntity.description"
	                          	placeholder="摘要" id="summary" value="<#if pictureEntity.description??>${pictureEntity.description}</#if>" >
	                          </input>
	                      </div>
	                    </div>
	                    <div class="form-group">
                              <label class="col-sm-2 col-sm-2 control-label">内容</label>
                              <div class="col-sm-10">
                                  <script id="content" name="content" type="text/plain"
										style="width: 100%; height: 260px;">${pictureEntity.content!}</script>
								  <script type="text/javascript">
									var contentEditor;
									$(function() {
										contentEditor = UE.getEditor('content');
									});
								  </script>
                              </div>
                        </div>
                    <div class="form-group">
                    	<label class="col-sm-2 col-sm-2 control-label"></label>
                        <button class="btn btn-danger" type="submit">修改</button>
                    </div>
                   </fieldset>
				</form>
				</div>
			</section>
		</div>
		</div>
<!-- page end-->
		</section>
	</section>
 <!--main content end-->
<script type="text/javascript">
	$(function() {
		$('#update_picture_form').ajaxForm({
			dataType : 'json',
			success : function(data) {
				if (data.result) {
					bootbox.alert("保存成功，将刷新页面", function() {
						window.location.reload();
					});
				}else{
					showErrors($('#update_picture_form'),data.errors);
				}
			},
			error:function(data,textstatus){
		        bootbox.alert({  
		            buttons: {  
		               ok: {  
		                    label: '关闭'
		               }  
		            },
		            message: textstatus+":"+data.responseText,
		            title: '<@spring.message "system.errorTip"/>',  
		        });
	        }
		});
	});	
</script>
<#include "/system/foot.ftl">
